﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Bastanteo.Dominio;
using NHibernate;
using NHibernate.Criterion;

namespace Bastanteo.Persistencia.NH
{
    public class ClienteDAO : BaseDAO<Cliente, Int32>, IClienteDAO
    {
        public Cliente ObtenerPorRuc(string ruc)
        {
            using (ISession sesion = NHibernateHelper.ObtenerSesion())
            {
                ICriteria busqueda = sesion.CreateCriteria(typeof(Cliente));
                busqueda.Add(Restrictions.Eq("Ruc", ruc));
                return busqueda.UniqueResult<Cliente>();
            }
        }
    }
}